﻿@model LeadVinaglue.Models.ViewPages.UserManagementModel
           
@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <title>Chọn địa chỉ e-mail</title>
	<link href="/Content/global.css" rel="stylesheet" type="text/css" />
	<link href="/Content/gridview.css" rel="stylesheet" type="text/css" />
	<link href="/Content/popup.css" rel="stylesheet" type="text/css" />
    <script src="/Scripts/jquery-1.7.2.min.js" type="text/javascript"></script>
    <script src="/Scripts/knockout-latest.js" type="text/javascript"></script>
    <script src="/Scripts/knockout.validation.js" type="text/javascript"></script>
    <script src="/Scripts/fancybox.js" type="text/javascript"></script>
    <script src="/Scripts/jquery.main.js" type="text/javascript"></script>
    <script src="/Scripts/jquery.bar.js" type="text/javascript"></script>
    <script src="/Scripts/menu.js" type="text/javascript"></script>
    <script src="/Scripts/global.js" type="text/javascript"></script>
</head>
<body class="leads-view dashboard">
    <div id="wrapper">
		<div class="w1" style="padding:0px !important">
			<div id="main">
				<div class="container">
                    <div id="apps" class="content">
                        <span class="paging">
                            <span class="pageleft">                
                                <span class="total" data-bind='text: PageText'></span>
                                <span class="show">Hiển thị <input type="text" class="text" id="pagesize" readonly="readonly" data-bind='value: PageSize, attr: {maxlength: 3}, event: { keypress: RunSomethingKey }' /> trên trang <span class="smallText error-red" data-bind="text: PageSizeText"></span> </span>
                            </span>
                            <span class="pages">
                                <span class="smallText error-red" data-bind="text: PageCurrentText"></span>Trang <input type="text" class="text" id="pagecurrent" data-bind='value: CurrentPageIndex, event: { keypress: RunSomethingKey }' /> của <span data-bind='text: MaxPageIndex' class="totalpages"></span>
                                <a href="#" data-bind='click: PrevPage, attr: {class: PrevButtonClass}'>Prev </a>
  		                        <a href="#" data-bind='click: NextPage, attr: {class: NextButtonClass}'>Next </a>
                            </span>
                        </span>

                        <div id="gridLead" class="table table-leads">
                            <div id="progressbar"></div>
                            <div class="title">
                                <div class="col1" style="width:170px" data-bind='click: function(event) { SetOrder(event, "Fullname")}'>
                                    <span class="w" style="height:22px">
                                        <a href="#">Tên</a>
                                        <div class="sort_wrapper" id="Fullname">  
                                            <span class="grid_order ui_icon"></span>
                                        </div>                                        
                                    </span>                          
                                </div>
		                        <div class="col1 col2" style="width:317px" data-bind='click: function(event) { SetOrder(event, "Email")}'>
                                    <span class="w" style="height:22px">
                                        <a href="#">E-mail</a>
                                        <div class="sort_wrapper" id="Email">  
                                            <span class="grid_order ui_icon"></span>
                                        </div>              
                                    </span>
                                </div>
		                        <div class="col1 col3" data-bind='click: function(event) { SetOrder(event, "CreationDate")}'>
                                    <span class="w" style="height:22px">
                                        <a href="#">Ngày tạo</a>
                                        <div class="sort_wrapper" id="CreationDate">  
                                            <span class="grid_order ui_icon desc"></span>
                                        </div>              
                                    </span>
                                </div>
		                        <div class="col1 col4" data-bind='click: function(event) { SetOrder(event, "IsLockedOut")}'>
                                    <span class="w" style="height:22px">
                                        <a href="#">Trạng thái</a>
                                        <div class="sort_wrapper" id="IsLockedOut">  
                                            <span class="grid_order ui_icon"></span>
                                        </div>              
                                    </span>
                                </div>
		                        <div class="col1 col12 centeralign""><span class="w" style="height:22px">Lượt</span></div>
                            </div>
                            <div class="linegroup" data-bind="foreach: Accounts">
                                <div class="line" data-bind='css: {"line" : IsLockedOut===false, "line new": IsLockedOut!==false}'>                        
			                        <div class="col1" style="width:170px"><span class="w" style="min-height: 24px;"><a class="preview" href="##" data-bind='text: Fullname'></a></span></div>
			                        <div class="col1 col2" style="width:317px"><span class="w" style="min-height: 24px;"><a data-bind='text: Email, attr: {href: "mailto:" + Email}'></a></span></div>
			                        <div class="col1 col3"><span class="w" style="min-height: 24px;" data-bind='text: CreationDate'></span></div>
			                        <div class="col1 col4"><span class="w" style="min-height: 24px;"><span class="green" data-bind='text: Status, attr: {id: "status" + ID}'></span></span></div>			
			                        <div class="col1 col12 centeralign">
                                        <span class="w" style="min-height: 24px;" data-bind='text: NumLogin' ></span>                                
                                    </div>
                                </div>
                            </div>
                        </div>   
                        <div class="clear"></div>
                        <div><a href="javascript:selectEmailAddress('close');">Chọn & đóng</a> | <a href="javascript:selectEmailAddress('');">Chọn</a></div>
                    </div>
				</div>
			</div>
			
		</div>
	</div>     
    <script type="text/javascript">
        var data = @(Html.Raw(Json.Encode(Model)));
    </script>
    <script src="/Scripts/viewModel/SelectAccountGrid.js" type="text/javascript"></script> 
    <script type="text/javascript">
        function selectEmailAddress(action) {
            // Find email address
            $('#gridLead .line').each(function () {
                var oldEmail = $('#ToEmailAddress', window.opener.document).val();
                if (oldEmail != "")
                    oldEmail += "; ";
                $('#ToEmailAddress', window.opener.document).val(oldEmail + $(this).find('.col2 span.w').text());

            });

            if (actioin == 'close')
                window.close();
        }
    </script>
</body>
</html>